package com.ytzl.config;

import com.ytzl.interceptor.JwtInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    public void addInterceptor(InterceptorRegistry registry){
        registry.addInterceptor(new JwtInterceptor())
                .addPathPatterns("/user/test")//拦截路径
                .excludePathPatterns("/user/login");//放行路径
    }
}
